/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.project.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Malek
 */
@Entity
@Table(name = "CARACTERISTIQUE", catalog = "", schema = "ONECOMMERCE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Caracteristique.findAll", query = "SELECT c FROM Caracteristique c"),
    @NamedQuery(name = "Caracteristique.findByIdcarac", query = "SELECT c FROM Caracteristique c WHERE c.idcarac = :idcarac"),
    @NamedQuery(name = "Caracteristique.findByDecription", query = "SELECT c FROM Caracteristique c WHERE c.decription = :decription"),
    @NamedQuery(name = "Caracteristique.findByNomcarac", query = "SELECT c FROM Caracteristique c WHERE c.nomcarac = :nomcarac")})
public class Caracteristique implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "IDCARAC", nullable = false, precision = 22, scale = 0)
    private BigDecimal idcarac;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "DECRIPTION", nullable = false, length = 50)
    private String decription;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "NOMCARAC", nullable = false, length = 50)
    private String nomcarac;
    @JoinColumn(name = "IDITEM", referencedColumnName = "IDITEM", nullable = false)
    @ManyToOne(optional = false)
    private Item iditem;

    public Caracteristique() {
    }

    public Caracteristique(BigDecimal idcarac) {
        this.idcarac = idcarac;
    }

    public Caracteristique(BigDecimal idcarac, String decription, String nomcarac) {
        this.idcarac = idcarac;
        this.decription = decription;
        this.nomcarac = nomcarac;
    }

    public BigDecimal getIdcarac() {
        return idcarac;
    }

    public void setIdcarac(BigDecimal idcarac) {
        this.idcarac = idcarac;
    }

    public String getDecription() {
        return decription;
    }

    public void setDecription(String decription) {
        this.decription = decription;
    }

    public String getNomcarac() {
        return nomcarac;
    }

    public void setNomcarac(String nomcarac) {
        this.nomcarac = nomcarac;
    }

    public Item getIditem() {
        return iditem;
    }

    public void setIditem(Item iditem) {
        this.iditem = iditem;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idcarac != null ? idcarac.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caracteristique)) {
            return false;
        }
        Caracteristique other = (Caracteristique) object;
        if ((this.idcarac == null && other.idcarac != null) || (this.idcarac != null && !this.idcarac.equals(other.idcarac))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.project.entities.Caracteristique[ idcarac=" + idcarac + " ]";
    }
    
}
